package com.webproject.service.impl.carManager;

import com.webproject.core.Page;
import com.webproject.dao.carManager.CarManagerDao;
import com.webproject.entity.carManager.CarPosition;
import com.webproject.entity.carManager.StopCar;
import com.webproject.entity.carManager.StopCarCost;
import com.webproject.entity.carManager.StopCarCostRelation;
import com.webproject.service.carManager.CarManagerService;

public class CarManagerServiceImpl implements CarManagerService{
	private CarManagerDao carManagerDao;

	public CarManagerDao getCarManagerDao() {
		return carManagerDao;
	}

	public void setCarManagerDao(CarManagerDao carManagerDao) {
		this.carManagerDao = carManagerDao;
	}

	@Override
	public void queryCarPosition(Page page) {
		// TODO Auto-generated method stub
		page.setRows(carManagerDao.queryCarPosition(page));
		page.setRecords(carManagerDao.queryCarPositionCount(page));
	}

	@Override
	public void saveCarPosition(CarPosition carPosition) {
		// TODO Auto-generated method stub
		carManagerDao.saveCarPosition(carPosition);
	}

	@Override
	public void updateCarPosition(CarPosition carPosition) {
		// TODO Auto-generated method stub
		carManagerDao.updateCarPosition(carPosition);
	}

	@Override
	public void deleteCarPosition(CarPosition carPosition) {
		// TODO Auto-generated method stub
		carManagerDao.deleteCarPosition(carPosition);
	}

	@Override
	public void queryStopCar(Page page) {
		// TODO Auto-generated method stub
		page.setRows(carManagerDao.queryStopCars(page));
		page.setRecords(carManagerDao.queryStopCarsCount(page));
	}

	@Override
	public void saveStopCar(StopCar stopCar) {
		// TODO Auto-generated method stub
		carManagerDao.saveStopCar(stopCar);
	}

	@Override
	public void updateStopCar(StopCar stopCar) {
		// TODO Auto-generated method stub
		carManagerDao.updateStopCar(stopCar);
	}

	@Override
	public void deleteStopCar(StopCar stopCar) {
		// TODO Auto-generated method stub
		carManagerDao.deleteStopCar(stopCar);
	}

	@Override
	public void queryStopCarCost(Page page) {
		// TODO Auto-generated method stub
		page.setRows(carManagerDao.queryStopCarCost(page));
		page.setRecords(carManagerDao.queryStopCarCostCount(page));
	}

	@Override
	public void saveStopCarCost(StopCarCost carCost) {
		// TODO Auto-generated method stub
		carManagerDao.saveStopCarCost(carCost);
		StopCarCostRelation relation=new StopCarCostRelation();
		relation.setMoneyId(carCost.getId());
		relation.setStopCarId(carCost.getStopCarId());
		carManagerDao.saveStopCarCostRelation(relation);
	}

	@Override
	public void updateStopCarCost(StopCarCost carCost) {
		// TODO Auto-generated method stub
		carManagerDao.updateStopCarCost(carCost);
		StopCarCostRelation relation=new StopCarCostRelation();
		relation.setMoneyId(carCost.getId());
		relation.setStopCarId(carCost.getStopCarId());
		carManagerDao.updateStopCarCostRelation(relation);
	}

	@Override
	public void deleteStopCarCost(StopCarCost carCost) {
		// TODO Auto-generated method stub
		StopCarCostRelation relation=new StopCarCostRelation();
		relation.setMoneyId(carCost.getId());
		relation.setStopCarId(carCost.getStopCarId());
		carManagerDao.deleteStopCarCostRelation(relation);
		carManagerDao.deleteStopCarCost(carCost);
	}
	

}
